<template>
	<view :class="show?'content':'content_active'" @touchstart="touchstart" @touchend="touchend">
		<view class="row">
			<view class="pdl-1 pdr-1 col-17 my_center" :style="'height:calc(100vh-' + height + 'px);padding-top:' + height + 'px;'">
				<view class="row">
					<view class="col-6 t_center head_img">
						<image src="../../static/index/head_img.png" mode="heightFix"></image>
					</view>
					<view class="col-17 off-1 phone_number t_size_31">
						{{$public.teSplice(userInfo.telephone)}}
					</view>
				</view>
				<view class="row">
					<view class="col-24 news_">
						<image src="../../static/index/news_.png" mode="widthFix" style="width: 100%;"></image>
					</view>
				</view>
				<view class="row">
					<view class="col-24">
						<view class="row list" @click="navTos('trip/trip_index')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/wdxc@2x.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								我的行程
							</view>
						</view>
						<view class="row list" @click="navTos('coupon/coupon_list')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/yhq@2x.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								优惠券
							</view>
						</view>
						<view class="row list" @click="navTos('invoice/invoice_list')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/fp.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								开发票
							</view>
						</view>
						<view class="row list" @click="navTos('account/account_list')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/zhyaq@2x.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								账号与安全
							</view>
						</view>
						<view class="row list" @click="navTos('account/account_kfzx')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/kf@2x.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								联系客服
							</view>
						</view>
						<view class="row list" @click="$public.navTo('public/setout/setout')">
							<view class="col-4 t_left">
								<image src="../../static/index/label_icon/sz@2x.png" mode="widthFix"></image>
							</view>
							<view class="col-18 t_size_26">
								设置
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="col-5" :style="'height:calc(100vh-' + height + 'px);padding-top:' + height + 'px;'" @click="change_show"></view>
		</view>
	</view>
</template>

<script>
	export default {
		name:'self-show',
		props:{
			show: {
				type:Boolean,
				default:()=>{
					return false
				}
			},
			userInfo:{
				type: Object,
				default:()=>{
					return {
						id: 0,
						telephone: '0'
					}
				}
			}
		},
		data(){
			return {
				height: 0,
				scliendX: 0,
				ecliendX: 0
			}
		},
		created() {
			let that = this;
			uni.getSystemInfo({
				success(res) {
					that.height = res.statusBarHeight+40;
				}
			})
		},
		methods:{
			//向父组件传递消息事件被点击
			change_show(){
				this.$emit('change_show', this.show)
			},
			//监听左滑事件
			touchstart({changedTouches}){
				changedTouches = changedTouches[0];
				this.scliendX = changedTouches.clientX;
			},
			touchend({changedTouches}){
				changedTouches = changedTouches[0];
				this.ecliendX = changedTouches.clientX;
				if(this.scliendX - this.ecliendX > 50){
					this.change_show();
				}
			},
			navTos(url){
				this.change_show();
				this.$public.navTo(url);
			}
		}
	}
</script>

<style lang="scss">
	.content,
	.content_active{
		width: 100vw;
		background-color: rgba(0,0,0,0.4);
		position: fixed;
		top: 0;
		left: 0;
		z-index: 5;
		transition-duration: 0.2s;
		/*     以下三值为默认值，稍后会详细介绍 */
		transition-property: all;
		transition-timing-function: ease;
		transition-delay: 0s;
		.my_center{
			height: 100vh;
			background-color: #FFFFFF;
			.head_img{
				height: 90rpx;
				image{
					height: 100%;
				}
			}
			.phone_number{
				height: 90rpx;
				line-height: 90rpx;
				font-weight: bold;
				color: #333333;
			}
		}
		.news_{
			margin-top: 35rpx;
		}
		.list{
			height: 50rpx;
			line-height: 50rpx;
			color: #333333;
			// font-weight: bold;
			margin: 35rpx 0;
			.t_left{
				image{
					width: 50rpx;
				}
			}
		}
	}
	.content_active{
		left: -110vw;
	}
</style>
